home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazine 28 Bonus / CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin / data / crpplay.dir / 00072_Script_MOVIE handlers < prev    next >
Text File  |  1996-05-27  |  6KB  |  213 lines

  1. -- ----------------------------------------------------------------
  2. -- Handler initializePictureGame does whatever is necessary to 
  3. -- make the game work.
  4.  
  5. on initializePictureGame
  6.   setPictureGameSprites
  7.   setPictureGamePuppets(TRUE)
  8.   setPictureGameCastLists
  9.   setColorStatus
  10.   
  11.   global numColors 
  12.   set numColors = 5
  13. end
  14.  
  15. -- ----------------------------------------------------------------
  16. -- Handler setPictureGameSprites sets the sprites for each clickable
  17. -- item in the picture
  18.  
  19. on setPictureGameSprites
  20.   global ceiling, floor, people, table, walls
  21.   
  22.   set ceiling = 2
  23.   set floor = 3
  24.   set people = 4
  25.   set table = 15
  26.   set walls = 6
  27. end
  28.  
  29. -- ----------------------------------------------------------------
  30. -- Handler setPictureGamePuppets sets the puppets of each the sprites for the
  31. -- clickable items in the picture to the given value. 
  32.  
  33. on setPictureGamePuppets val
  34.   global ceiling, floor, people, table, walls
  35.   
  36.   puppetSprite ceiling, val
  37.   puppetSprite floor, val
  38.   puppetSprite people, val
  39.   puppetSprite table, val
  40.   puppetSprite floor, val
  41.   puppetSprite walls, val
  42. end
  43.  
  44. -- ----------------------------------------------------------------
  45. -- Handler setPictureGameCastLists sets the list of casts for each object
  46. -- whose color is changeable.
  47.  
  48. on setPictureGameCastLists
  49.   global ceilingCasts, floorCasts, peopleCasts, tableCasts
  50.   global wallsCasts
  51.   
  52.   set ceilingCasts = ["ceiling ORIGINAL", "ceiling DARK", "ceiling GAY", "ceiling HAPPIER", "ceiling LIGHT"]
  53.   
  54.   set floorCasts = ["floor ORIGINAL", "floor DARK", "floor GAY", "floor HAPPIER", "floor LIGHT"]
  55.   
  56.   set peopleCasts = ["people ORIGINAL", "people DARK", "people GAY", "people HAPPIER", "people LIGHT"]
  57.   
  58.   set tableCasts = ["table ORIGINAL", "table DARK", "table GAY", "table HAPPIER", "table LIGHT"]
  59.   
  60.   set wallsCasts = ["walls ORIGINAL", "walls DARK", "walls GAY", "walls HAPPIER", "walls LIGHT"]
  61. end
  62.  
  63.  
  64. -- Handler setColorStatus sets the color mixture
  65.  
  66. on setColorStatus
  67.   global colorStatusList
  68.   
  69.   set colorStatusList = ["ORIGINAL","ORIGINAL","ORIGINAL","ORIGINAL","ORIGINAL"]
  70.   
  71. end
  72.  
  73.  
  74.  
  75. -- ----------------------------------------------------------------
  76. -- Handler changeColor changes the color of the given object when
  77. -- it is clicked on
  78.  
  79. on changeColor object
  80.   global ceilingCasts, floorCasts, peopleCasts, tableCasts
  81.   global wallsCasts, numColors
  82.   global ceiling, floor, people, table, walls
  83.   
  84.   
  85.   if object = "ceiling" then
  86.     set castList = ceilingCasts
  87.     set changeSprite = ceiling
  88.     set colorPosition = 1
  89.     
  90.   else if object = "floor" then
  91.     set castList = floorCasts
  92.     set changeSprite = floor
  93.     set colorPosition = 2
  94.     
  95.   else if object = "people" then
  96.     set castList = peopleCasts
  97.     set changeSprite = people
  98.     set colorPosition = 3
  99.     
  100.   else if object = "table" then
  101.     set castList = tableCasts
  102.     set changeSprite = table
  103.     set colorPosition = 4
  104.     
  105.   else if object = "walls" then
  106.     set castList = wallsCasts
  107.     set changeSprite = walls
  108.     set colorPosition = 5
  109.   end if
  110.   
  111.   set newCast = getAt(castList,random(numColors))
  112.   set newColor = word 2 of newCast
  113.   set the castNum of sprite changeSprite = the number of cast newCast
  114.   
  115.   --  set colorOffset = getColorOffset(newColor)
  116.   --  changeGroupColors(object, colorOffset, newColor)
  117.   updateStage
  118.   
  119.   upDateColorMixture(colorPosition,newColor)
  120.   checkColorMixture
  121. end
  122.  
  123. -- ----------------------------------------------------------------
  124. -- Handler getColorOffset returns the position in the cast lists
  125. -- that the color is found in.
  126.  
  127. on getColorOffset color
  128.   if color = "DARK" then
  129.     return 2
  130.   else if color = "GAY" then
  131.     return 3
  132.   else if color = "HAPPIER" then
  133.     return 4
  134.   else if color = "LIGHT" then 
  135.     return 5
  136.   else if color = "ORIGINAL" then
  137.     return 1
  138.   end if
  139. end
  140.  
  141. -- ----------------------------------------------------------------
  142. -- Handler changeGroupColors receives and object and the castOffset
  143. -- and changes the casts of all objects in the object's group to
  144. -- the same color.
  145. --
  146. -- NOT USED IN THIS VERIOSN - NO GROUPS
  147. --
  148. -- on changeGroupColors object, colorOffset, newColor
  149. --  global chairGroup, wallsGroup, yellowGroup
  150. --  
  151. --  if listMember(object, chairGroup) then
  152. --    set group = chairGroup
  153. --  else if listMember(object, wallsGroup) then
  154. --    set group = wallsGroup
  155. --  else if listMember(object, yellowGroup) then
  156. --    set group = yellowGroup
  157. --  else -- not in a group
  158. --    set group = []
  159. --  end if
  160. --  
  161. --  repeat with i = 1 to count(group)
  162. --    -- the groups members are strings which correspond to the 
  163. --    -- global variables for sprites.  so, use the value of the
  164. --    -- string to get the sprite whose cast needs to be changed.
  165. --    set member = getAt(group,i)
  166. --    set whichSprite = value(member)
  167. --    set newCast = member && newColor
  168. --    set the castNum of sprite whichSprite = the number of cast newCast
  169. --  end repeat
  170. --end
  171. --
  172.  
  173. -- ----------------------------------------------------------------
  174. -- Handler listMember returns TRUE if the given object is a member
  175. -- of the given list and FALSE otherwise.
  176.  
  177. on listMember object, aList
  178.   set memberP = FALSE
  179.   
  180.   repeat with i = 1 to count(aList)
  181.     if object = getAt(aList, i) then
  182.       set memberP = TRUE
  183.       exit Repeat
  184.     end if
  185.   end repeat
  186.   
  187.   return memberP
  188. end
  189.  
  190. on upDateColorMixture colorPosition,newColor
  191.   global colorStatusList
  192.   setAt  colorStatusList,colorPosition,newColor
  193.   put colorStatusList
  194. end
  195.  
  196.  
  197. on checkColorMixture 
  198.   global colorStatusList
  199.   
  200.   if  colorStatusList = ["ORIGINAL","ORIGINAL","ORIGINAL","ORIGINAL","ORIGINAL"] then
  201.     puppetSound "original"
  202.   else if colorStatusList = ["DARK","DARK","DARK","DARK","DARK"] then
  203.     puppetSound "dark"
  204.   else if colorStatusList = ["GAY","GAY","GAY","GAY","GAY"] then
  205.     puppetSound "gay"
  206.   else if colorStatusList = ["HAPPIER","HAPPIER","HAPPIER","HAPPIER","HAPPIER"] then
  207.     puppetSound "happier"
  208.   else if colorStatusList = ["LIGHT","LIGHT","LIGHT","LIGHT","LIGHT"] then
  209.     puppetSound "light"
  210.   end if
  211.   
  212. end
  213.